define([
  'views/Modal',
  'hbs!template/media/media-modal-viewer'
], function(Modal,
            media_modal_template){
  var ModalMediaViewer = Modal.extend({
    template: media_modal_template,
    
    initialize: function(options) {
      options || (options = {});
      Modal.prototype.initialize.call(this, options);

      if(options.viewer) { // If not throw Error
        this._viewer = options.viewer;
      }

      //      this._viewer.flags.modal = false;

      this.bind("shown", this.renderContain, this);
    },

    renderContain: function() {
      if(this._viewer) {
        console.log(this._viewer.render().el);
        this.$("#viewer").html(this._viewer.render().el);
      }
    }
  });

  return ModalMediaViewer;
});

